package cn.ac.siom.query.service.impl;

import cn.ac.siom.query.dao.Ikjjggs_newsDAO;
import cn.ac.siom.query.service.Ikjjggs_newsService;
import cn.ac.siom.query.vo.kjjggs_news;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class kjjggs_newsServiceImpl implements Ikjjggs_newsService {


    @Resource
    private Ikjjggs_newsDAO kjjggs_newsDAO;

    @Override
    public Map findByParams(Map params) throws Exception {
        List<kjjggs_news> list=this.kjjggs_newsDAO.findByParams(params);
        Integer count =this.kjjggs_newsDAO.findCount(params);
        Map map=new HashMap();
        map.put("data",list);
        map.put("count",count);
        map.put("page_id",params.get("page_id"));
        return map;
    }

    @Override
    public List<kjjggs_news> list() throws SQLException {
        return this.kjjggs_newsDAO.findAll();
    }

    @Override
    public List<kjjggs_news> list_NO(Integer i_id) throws SQLException {
        List<kjjggs_news> kjjggs_news=this.kjjggs_newsDAO.findNo(i_id);
        return kjjggs_news;
    }

    @Override
    public List<kjjggs_news> list_page(Integer rownum, Integer page_id) throws SQLException {
        List<kjjggs_news> kjjggs_news=this.kjjggs_newsDAO.findPage(rownum,page_id);
        return kjjggs_news;
    }

    @Override
    public Integer list_count() throws SQLException {
        return this.kjjggs_newsDAO.findCount(new HashMap());
    }

    @Override
    public String list_Photo(Integer i_id) throws SQLException {
        return this.kjjggs_newsDAO.findPhoto(i_id);
    }

    @Override
    public boolean insert(kjjggs_news vo) throws SQLException {
        return this.kjjggs_newsDAO.insert(vo);
    }

    @Override
    public boolean update(kjjggs_news vo) throws Exception {
        return this.kjjggs_newsDAO.update(vo);
    }

    @Override
    public boolean delete(List<String> ids) throws Exception {
        return this.kjjggs_newsDAO.delete(ids);
    }

}
